package com.xckj.zuoliao.ui.activity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.view.View;

import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.xckj.zuoliao.R;
import com.xckj.zuoliao.bean.DetailsBean;
import com.xckj.zuoliao.bean.ListBean;
import com.xckj.zuoliao.databinding.ActivityHongKongDetailsBinding;
import com.xckj.zuoliao.framework.BaseActivity;
import com.xckj.zuoliao.global.Constant;
import com.xckj.zuoliao.iview.IDetailsView;
import com.xckj.zuoliao.presenter.DetailsPresenter;
import com.xckj.zuoliao.ui.adapter.NumberOfPeriodsAdapter;
import com.xckj.zuoliao.utils.SpUtil;
import com.xckj.zuoliao.view.CustomDialogView;

import java.util.List;
import java.util.Objects;

/**
 * @Author: 代码的搬运工
 * @Describe: 香港详情
 * @Date: 2024/3/30 03:32
 */
public class HongKongDetailsActivity extends BaseActivity<ActivityHongKongDetailsBinding> implements IDetailsView {
    private String colum;
    private DetailsPresenter detailsPresenter;
    private int selectedPosition = 0;

    @Override
    protected int loadLayout() {
        return R.layout.activity_hong_kong_details;
    }

    @Override
    protected void initData() {
        dataBinding.viewTitleBar.tvTitle.setText("香港会员专区");
        colum = getIntent().getStringExtra(Constant.COLUM);
        setView();
        detailsPresenter = new DetailsPresenter(this);
    }

    @Override
    protected void onResume() {
        super.onResume();
        detailsPresenter.getDetails(SpUtil.getString(this, Constant.ID), Constant.AREA_TYPE_2, colum, "");
    }

    @SuppressLint("NotifyDataSetChanged")
    private void initNumberOfPeriods(List<DetailsBean.GameStageLists> gameStageListsList) {
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, RecyclerView.HORIZONTAL, false);
        dataBinding.rvNumberOfPeriods.setLayoutManager(linearLayoutManager);
        NumberOfPeriodsAdapter numberOfPeriodsAdapter = new NumberOfPeriodsAdapter(this);
        SpUtil.put(this, Constant.SELECTED_POSITION, selectedPosition);
        dataBinding.rvNumberOfPeriods.setAdapter(numberOfPeriodsAdapter);
        numberOfPeriodsAdapter.setOnItemClickListener((view, position) -> {
            selectedPosition = position;
            SpUtil.put(this, Constant.SELECTED_POSITION, selectedPosition);
            detailsPresenter.getDetails(SpUtil.getString(this, Constant.ID), Constant.AREA_TYPE_2, colum, gameStageListsList.get(position).stage_no);
        });
        numberOfPeriodsAdapter.setData(gameStageListsList);
        linearLayoutManager.scrollToPosition(selectedPosition);
        numberOfPeriodsAdapter.notifyDataSetChanged();
    }

    private void setView() {
        switch (colum) {
            case Constant.TYPE_1:
                dataBinding.llYxym.setVisibility(View.VISIBLE);
                dataBinding.ivPicture.setBackgroundResource(R.mipmap.img_yxym);
                break;
            case Constant.TYPE_2:
                dataBinding.llSxsm.setVisibility(View.VISIBLE);
                dataBinding.ivPicture.setBackgroundResource(R.mipmap.img_sxsm);
                break;
            case Constant.TYPE_3:
                dataBinding.llTjlx.setVisibility(View.VISIBLE);
                dataBinding.ivPicture.setBackgroundResource(R.mipmap.img_tjlx);
                break;
            case Constant.TYPE_4:
                dataBinding.llZds.setVisibility(View.VISIBLE);
                dataBinding.ivPicture.setBackgroundResource(R.mipmap.img_zds);
                break;
            case Constant.TYPE_5:
                dataBinding.llJzts.setVisibility(View.VISIBLE);
                dataBinding.ivPicture.setBackgroundResource(R.mipmap.img_jzts);
                break;
            case Constant.TYPE_6:
                dataBinding.llWzws.setVisibility(View.VISIBLE);
                dataBinding.ivPicture.setBackgroundResource(R.mipmap.img_wzws);
                break;
            case Constant.TYPE_7:
                dataBinding.llCsbs.setVisibility(View.VISIBLE);
                dataBinding.ivPicture.setBackgroundResource(R.mipmap.img_csbs);
                break;
            case Constant.TYPE_8:
                dataBinding.llJjcp.setVisibility(View.VISIBLE);
                dataBinding.ivPicture.setBackgroundResource(R.mipmap.img_jjcp);
                break;
            case Constant.TYPE_9:
                dataBinding.llSzs.setVisibility(View.VISIBLE);
                dataBinding.ivPicture.setBackgroundResource(R.mipmap.img_szs);
                break;
            case Constant.TYPE_10:
                dataBinding.llDdym.setVisibility(View.VISIBLE);
                dataBinding.ivPicture.setBackgroundResource(R.mipmap.img_ddym);
                break;
            default:
                break;
        }
    }

    @Override
    protected void setListener() {
        dataBinding.viewTitleBar.ivBack.setOnClickListener(view -> {
            finish();
        });
    }

    @Override
    public void success(DetailsBean detailsBean) {
        if (detailsBean.number.size() != 0) {
            setCode(detailsBean);
            setCodeBlackGround1(detailsBean);
            setCodeBlackGround2(detailsBean);
            setCodeBlackGround3(detailsBean);
            setCodeBlackGround4(detailsBean);
            setCodeBlackGround5(detailsBean);
            setCodeBlackGround6(detailsBean);
            setCodeBlackGround7(detailsBean);
        } else {
            showMsg("数据格式不对，请联系管理员");
        }
        if (detailsBean.zodiac.size() != 0) {
            setZodiacSign(detailsBean);
        } else {
            showMsg("数据格式不对，请联系管理员");
        }
        if (detailsBean.detail.size() != 0) {
            setDetails(detailsBean);
        } else {
            showMsg("数据格式不对，请联系管理员");
        }
        initNumberOfPeriods(detailsBean.game_stage_lists);
    }

    private void setCode(DetailsBean detailsBean) {
        dataBinding.tvCode1.setText(detailsBean.number.get(0));
        dataBinding.tvCode2.setText(detailsBean.number.get(1));
        dataBinding.tvCode3.setText(detailsBean.number.get(2));
        dataBinding.tvCode4.setText(detailsBean.number.get(3));
        dataBinding.tvCode5.setText(detailsBean.number.get(4));
        dataBinding.tvCode6.setText(detailsBean.number.get(5));
        dataBinding.tvCode7.setText(detailsBean.number.get(6));
    }

    private void setZodiacSign(DetailsBean detailsBean) {
        dataBinding.tvZodiacSign1.setText(detailsBean.zodiac.get(0));
        dataBinding.tvZodiacSign2.setText(detailsBean.zodiac.get(1));
        dataBinding.tvZodiacSign3.setText(detailsBean.zodiac.get(2));
        dataBinding.tvZodiacSign4.setText(detailsBean.zodiac.get(3));
        dataBinding.tvZodiacSign5.setText(detailsBean.zodiac.get(4));
        dataBinding.tvZodiacSign6.setText(detailsBean.zodiac.get(5));
        dataBinding.tvZodiacSign7.setText(detailsBean.zodiac.get(6));
    }

    private void setCodeBlackGround1(DetailsBean detailsBean) {
        if (Constant.CODE_1.equals(detailsBean.number.get(0)) || Constant.CODE_2.equals(detailsBean.number.get(0)) || Constant.CODE_7.equals(detailsBean.number.get(0)) || Constant.CODE_8.equals(detailsBean.number.get(0)) || Constant.CODE_12.equals(detailsBean.number.get(0)) || Constant.CODE_13.equals(detailsBean.number.get(0)) || Constant.CODE_18.equals(detailsBean.number.get(0)) || Constant.CODE_19.equals(detailsBean.number.get(0)) || Constant.CODE_23.equals(detailsBean.number.get(0)) || Constant.CODE_24.equals(detailsBean.number.get(0)) || Constant.CODE_29.equals(detailsBean.number.get(0)) || Constant.CODE_30.equals(detailsBean.number.get(0)) || Constant.CODE_34.equals(detailsBean.number.get(0)) || Constant.CODE_35.equals(detailsBean.number.get(0)) || Constant.CODE_40.equals(detailsBean.number.get(0)) || Constant.CODE_45.equals(detailsBean.number.get(0)) || Constant.CODE_46.equals(detailsBean.number.get(0))) {
            dataBinding.tvCode1.setBackgroundResource(R.mipmap.img_code_red);
        } else if (Constant.CODE_3.equals(detailsBean.number.get(0)) || Constant.CODE_4.equals(detailsBean.number.get(0)) || Constant.CODE_9.equals(detailsBean.number.get(0)) || Constant.CODE_10.equals(detailsBean.number.get(0)) || Constant.CODE_14.equals(detailsBean.number.get(0)) || Constant.CODE_15.equals(detailsBean.number.get(0)) || Constant.CODE_20.equals(detailsBean.number.get(0)) || Constant.CODE_25.equals(detailsBean.number.get(0)) || Constant.CODE_26.equals(detailsBean.number.get(0)) || Constant.CODE_31.equals(detailsBean.number.get(0)) || Constant.CODE_36.equals(detailsBean.number.get(0)) || Constant.CODE_37.equals(detailsBean.number.get(0)) || Constant.CODE_41.equals(detailsBean.number.get(0)) || Constant.CODE_42.equals(detailsBean.number.get(0)) || Constant.CODE_47.equals(detailsBean.number.get(0)) || Constant.CODE_48.equals(detailsBean.number.get(0))) {
            dataBinding.tvCode1.setBackgroundResource(R.mipmap.img_code_blue);
        } else {
            dataBinding.tvCode1.setBackgroundResource(R.mipmap.img_code_green);
        }
    }

    private void setCodeBlackGround2(DetailsBean detailsBean) {
        if (Constant.CODE_1.equals(detailsBean.number.get(1)) || Constant.CODE_2.equals(detailsBean.number.get(1)) || Constant.CODE_7.equals(detailsBean.number.get(1)) || Constant.CODE_8.equals(detailsBean.number.get(1)) || Constant.CODE_12.equals(detailsBean.number.get(1)) || Constant.CODE_13.equals(detailsBean.number.get(1)) || Constant.CODE_18.equals(detailsBean.number.get(1)) || Constant.CODE_19.equals(detailsBean.number.get(1)) || Constant.CODE_23.equals(detailsBean.number.get(1)) || Constant.CODE_24.equals(detailsBean.number.get(1)) || Constant.CODE_29.equals(detailsBean.number.get(1)) || Constant.CODE_30.equals(detailsBean.number.get(1)) || Constant.CODE_34.equals(detailsBean.number.get(1)) || Constant.CODE_35.equals(detailsBean.number.get(1)) || Constant.CODE_40.equals(detailsBean.number.get(1)) || Constant.CODE_45.equals(detailsBean.number.get(1)) || Constant.CODE_46.equals(detailsBean.number.get(1))) {
            dataBinding.tvCode2.setBackgroundResource(R.mipmap.img_code_red);
        } else if (Constant.CODE_3.equals(detailsBean.number.get(1)) || Constant.CODE_4.equals(detailsBean.number.get(1)) || Constant.CODE_9.equals(detailsBean.number.get(1)) || Constant.CODE_10.equals(detailsBean.number.get(1)) || Constant.CODE_14.equals(detailsBean.number.get(1)) || Constant.CODE_15.equals(detailsBean.number.get(1)) || Constant.CODE_20.equals(detailsBean.number.get(1)) || Constant.CODE_25.equals(detailsBean.number.get(1)) || Constant.CODE_26.equals(detailsBean.number.get(1)) || Constant.CODE_31.equals(detailsBean.number.get(1)) || Constant.CODE_36.equals(detailsBean.number.get(1)) || Constant.CODE_37.equals(detailsBean.number.get(1)) || Constant.CODE_41.equals(detailsBean.number.get(1)) || Constant.CODE_42.equals(detailsBean.number.get(1)) || Constant.CODE_47.equals(detailsBean.number.get(1)) || Constant.CODE_48.equals(detailsBean.number.get(1))) {
            dataBinding.tvCode2.setBackgroundResource(R.mipmap.img_code_blue);
        } else {
            dataBinding.tvCode2.setBackgroundResource(R.mipmap.img_code_green);
        }
    }

    private void setCodeBlackGround3(DetailsBean detailsBean) {
        if (Constant.CODE_1.equals(detailsBean.number.get(2)) || Constant.CODE_2.equals(detailsBean.number.get(2)) || Constant.CODE_7.equals(detailsBean.number.get(2)) || Constant.CODE_8.equals(detailsBean.number.get(2)) || Constant.CODE_12.equals(detailsBean.number.get(2)) || Constant.CODE_13.equals(detailsBean.number.get(2)) || Constant.CODE_18.equals(detailsBean.number.get(2)) || Constant.CODE_19.equals(detailsBean.number.get(2)) || Constant.CODE_23.equals(detailsBean.number.get(2)) || Constant.CODE_24.equals(detailsBean.number.get(2)) || Constant.CODE_29.equals(detailsBean.number.get(2)) || Constant.CODE_30.equals(detailsBean.number.get(2)) || Constant.CODE_34.equals(detailsBean.number.get(2)) || Constant.CODE_35.equals(detailsBean.number.get(2)) || Constant.CODE_40.equals(detailsBean.number.get(2)) || Constant.CODE_45.equals(detailsBean.number.get(2)) || Constant.CODE_46.equals(detailsBean.number.get(2))) {
            dataBinding.tvCode3.setBackgroundResource(R.mipmap.img_code_red);
        } else if (Constant.CODE_3.equals(detailsBean.number.get(2)) || Constant.CODE_4.equals(detailsBean.number.get(2)) || Constant.CODE_9.equals(detailsBean.number.get(2)) || Constant.CODE_10.equals(detailsBean.number.get(2)) || Constant.CODE_14.equals(detailsBean.number.get(2)) || Constant.CODE_15.equals(detailsBean.number.get(2)) || Constant.CODE_20.equals(detailsBean.number.get(2)) || Constant.CODE_25.equals(detailsBean.number.get(2)) || Constant.CODE_26.equals(detailsBean.number.get(2)) || Constant.CODE_31.equals(detailsBean.number.get(2)) || Constant.CODE_36.equals(detailsBean.number.get(2)) || Constant.CODE_37.equals(detailsBean.number.get(2)) || Constant.CODE_41.equals(detailsBean.number.get(2)) || Constant.CODE_42.equals(detailsBean.number.get(2)) || Constant.CODE_47.equals(detailsBean.number.get(2)) || Constant.CODE_48.equals(detailsBean.number.get(2))) {
            dataBinding.tvCode3.setBackgroundResource(R.mipmap.img_code_blue);
        } else {
            dataBinding.tvCode3.setBackgroundResource(R.mipmap.img_code_green);
        }
    }

    private void setCodeBlackGround4(DetailsBean detailsBean) {
        if (Constant.CODE_1.equals(detailsBean.number.get(3)) || Constant.CODE_2.equals(detailsBean.number.get(3)) || Constant.CODE_7.equals(detailsBean.number.get(3)) || Constant.CODE_8.equals(detailsBean.number.get(3)) || Constant.CODE_12.equals(detailsBean.number.get(3)) || Constant.CODE_13.equals(detailsBean.number.get(3)) || Constant.CODE_18.equals(detailsBean.number.get(3)) || Constant.CODE_19.equals(detailsBean.number.get(3)) || Constant.CODE_23.equals(detailsBean.number.get(3)) || Constant.CODE_24.equals(detailsBean.number.get(3)) || Constant.CODE_29.equals(detailsBean.number.get(3)) || Constant.CODE_30.equals(detailsBean.number.get(3)) || Constant.CODE_34.equals(detailsBean.number.get(3)) || Constant.CODE_35.equals(detailsBean.number.get(3)) || Constant.CODE_40.equals(detailsBean.number.get(3)) || Constant.CODE_45.equals(detailsBean.number.get(3)) || Constant.CODE_46.equals(detailsBean.number.get(3))) {
            dataBinding.tvCode4.setBackgroundResource(R.mipmap.img_code_red);
        } else if (Constant.CODE_3.equals(detailsBean.number.get(3)) || Constant.CODE_4.equals(detailsBean.number.get(3)) || Constant.CODE_9.equals(detailsBean.number.get(3)) || Constant.CODE_10.equals(detailsBean.number.get(3)) || Constant.CODE_14.equals(detailsBean.number.get(3)) || Constant.CODE_15.equals(detailsBean.number.get(3)) || Constant.CODE_20.equals(detailsBean.number.get(3)) || Constant.CODE_25.equals(detailsBean.number.get(3)) || Constant.CODE_26.equals(detailsBean.number.get(3)) || Constant.CODE_31.equals(detailsBean.number.get(3)) || Constant.CODE_36.equals(detailsBean.number.get(3)) || Constant.CODE_37.equals(detailsBean.number.get(3)) || Constant.CODE_41.equals(detailsBean.number.get(3)) || Constant.CODE_42.equals(detailsBean.number.get(3)) || Constant.CODE_47.equals(detailsBean.number.get(3)) || Constant.CODE_48.equals(detailsBean.number.get(3))) {
            dataBinding.tvCode4.setBackgroundResource(R.mipmap.img_code_blue);
        } else {
            dataBinding.tvCode4.setBackgroundResource(R.mipmap.img_code_green);
        }
    }

    private void setCodeBlackGround5(DetailsBean detailsBean) {
        if (Constant.CODE_1.equals(detailsBean.number.get(4)) || Constant.CODE_2.equals(detailsBean.number.get(4)) || Constant.CODE_7.equals(detailsBean.number.get(4)) || Constant.CODE_8.equals(detailsBean.number.get(4)) || Constant.CODE_12.equals(detailsBean.number.get(4)) || Constant.CODE_13.equals(detailsBean.number.get(4)) || Constant.CODE_18.equals(detailsBean.number.get(4)) || Constant.CODE_19.equals(detailsBean.number.get(4)) || Constant.CODE_23.equals(detailsBean.number.get(4)) || Constant.CODE_24.equals(detailsBean.number.get(4)) || Constant.CODE_29.equals(detailsBean.number.get(4)) || Constant.CODE_30.equals(detailsBean.number.get(4)) || Constant.CODE_34.equals(detailsBean.number.get(4)) || Constant.CODE_35.equals(detailsBean.number.get(4)) || Constant.CODE_40.equals(detailsBean.number.get(4)) || Constant.CODE_45.equals(detailsBean.number.get(4)) || Constant.CODE_46.equals(detailsBean.number.get(4))) {
            dataBinding.tvCode5.setBackgroundResource(R.mipmap.img_code_red);
        } else if (Constant.CODE_3.equals(detailsBean.number.get(4)) || Constant.CODE_4.equals(detailsBean.number.get(4)) || Constant.CODE_9.equals(detailsBean.number.get(4)) || Constant.CODE_10.equals(detailsBean.number.get(4)) || Constant.CODE_14.equals(detailsBean.number.get(4)) || Constant.CODE_15.equals(detailsBean.number.get(4)) || Constant.CODE_20.equals(detailsBean.number.get(4)) || Constant.CODE_25.equals(detailsBean.number.get(4)) || Constant.CODE_26.equals(detailsBean.number.get(4)) || Constant.CODE_31.equals(detailsBean.number.get(4)) || Constant.CODE_36.equals(detailsBean.number.get(4)) || Constant.CODE_37.equals(detailsBean.number.get(4)) || Constant.CODE_41.equals(detailsBean.number.get(4)) || Constant.CODE_42.equals(detailsBean.number.get(4)) || Constant.CODE_47.equals(detailsBean.number.get(4)) || Constant.CODE_48.equals(detailsBean.number.get(4))) {
            dataBinding.tvCode5.setBackgroundResource(R.mipmap.img_code_blue);
        } else {
            dataBinding.tvCode5.setBackgroundResource(R.mipmap.img_code_green);
        }
    }

    private void setCodeBlackGround6(DetailsBean detailsBean) {
        if (Constant.CODE_1.equals(detailsBean.number.get(5)) || Constant.CODE_2.equals(detailsBean.number.get(5)) || Constant.CODE_7.equals(detailsBean.number.get(5)) || Constant.CODE_8.equals(detailsBean.number.get(5)) || Constant.CODE_12.equals(detailsBean.number.get(5)) || Constant.CODE_13.equals(detailsBean.number.get(5)) || Constant.CODE_18.equals(detailsBean.number.get(5)) || Constant.CODE_19.equals(detailsBean.number.get(5)) || Constant.CODE_23.equals(detailsBean.number.get(5)) || Constant.CODE_24.equals(detailsBean.number.get(5)) || Constant.CODE_29.equals(detailsBean.number.get(5)) || Constant.CODE_30.equals(detailsBean.number.get(5)) || Constant.CODE_34.equals(detailsBean.number.get(5)) || Constant.CODE_35.equals(detailsBean.number.get(5)) || Constant.CODE_40.equals(detailsBean.number.get(5)) || Constant.CODE_45.equals(detailsBean.number.get(5)) || Constant.CODE_46.equals(detailsBean.number.get(5))) {
            dataBinding.tvCode6.setBackgroundResource(R.mipmap.img_code_red);
        } else if (Constant.CODE_3.equals(detailsBean.number.get(5)) || Constant.CODE_4.equals(detailsBean.number.get(5)) || Constant.CODE_9.equals(detailsBean.number.get(5)) || Constant.CODE_10.equals(detailsBean.number.get(5)) || Constant.CODE_14.equals(detailsBean.number.get(5)) || Constant.CODE_15.equals(detailsBean.number.get(5)) || Constant.CODE_20.equals(detailsBean.number.get(5)) || Constant.CODE_25.equals(detailsBean.number.get(5)) || Constant.CODE_26.equals(detailsBean.number.get(5)) || Constant.CODE_31.equals(detailsBean.number.get(5)) || Constant.CODE_36.equals(detailsBean.number.get(5)) || Constant.CODE_37.equals(detailsBean.number.get(5)) || Constant.CODE_41.equals(detailsBean.number.get(5)) || Constant.CODE_42.equals(detailsBean.number.get(5)) || Constant.CODE_47.equals(detailsBean.number.get(5)) || Constant.CODE_48.equals(detailsBean.number.get(5))) {
            dataBinding.tvCode6.setBackgroundResource(R.mipmap.img_code_blue);
        } else {
            dataBinding.tvCode6.setBackgroundResource(R.mipmap.img_code_green);
        }

    }

    private void setCodeBlackGround7(DetailsBean detailsBean) {
        if (Constant.CODE_1.equals(detailsBean.number.get(6)) || Constant.CODE_2.equals(detailsBean.number.get(6)) || Constant.CODE_7.equals(detailsBean.number.get(6)) || Constant.CODE_8.equals(detailsBean.number.get(6)) || Constant.CODE_12.equals(detailsBean.number.get(6)) || Constant.CODE_13.equals(detailsBean.number.get(6)) || Constant.CODE_18.equals(detailsBean.number.get(6)) || Constant.CODE_19.equals(detailsBean.number.get(6)) || Constant.CODE_23.equals(detailsBean.number.get(6)) || Constant.CODE_24.equals(detailsBean.number.get(6)) || Constant.CODE_29.equals(detailsBean.number.get(6)) || Constant.CODE_30.equals(detailsBean.number.get(6)) || Constant.CODE_34.equals(detailsBean.number.get(6)) || Constant.CODE_35.equals(detailsBean.number.get(6)) || Constant.CODE_40.equals(detailsBean.number.get(6)) || Constant.CODE_45.equals(detailsBean.number.get(6)) || Constant.CODE_46.equals(detailsBean.number.get(6))) {
            dataBinding.tvCode7.setBackgroundResource(R.mipmap.img_code_red);
        } else if (Constant.CODE_3.equals(detailsBean.number.get(6)) || Constant.CODE_4.equals(detailsBean.number.get(6)) || Constant.CODE_9.equals(detailsBean.number.get(6)) || Constant.CODE_10.equals(detailsBean.number.get(6)) || Constant.CODE_14.equals(detailsBean.number.get(6)) || Constant.CODE_15.equals(detailsBean.number.get(6)) || Constant.CODE_20.equals(detailsBean.number.get(6)) || Constant.CODE_25.equals(detailsBean.number.get(6)) || Constant.CODE_26.equals(detailsBean.number.get(6)) || Constant.CODE_31.equals(detailsBean.number.get(6)) || Constant.CODE_36.equals(detailsBean.number.get(6)) || Constant.CODE_37.equals(detailsBean.number.get(6)) || Constant.CODE_41.equals(detailsBean.number.get(6)) || Constant.CODE_42.equals(detailsBean.number.get(6)) || Constant.CODE_47.equals(detailsBean.number.get(6)) || Constant.CODE_48.equals(detailsBean.number.get(6))) {
            dataBinding.tvCode7.setBackgroundResource(R.mipmap.img_code_blue);
        } else {
            dataBinding.tvCode7.setBackgroundResource(R.mipmap.img_code_green);
        }
    }

    private void setDetails(DetailsBean detailsBean) {
        switch (colum) {
            case Constant.TYPE_1:
                dataBinding.tvYxym1.setText(detailsBean.detail.get(0).zodiac);
                dataBinding.tvYxym2.setText(detailsBean.detail.get(0).number);
                break;
            case Constant.TYPE_2:
                dataBinding.tvSxsm1.setText(detailsBean.detail.get(0).zodiac);
                dataBinding.tvSxsm4.setText(detailsBean.detail.get(0).number);
                dataBinding.tvSxsm2.setText(detailsBean.detail.get(1).zodiac);
                dataBinding.tvSxsm5.setText(detailsBean.detail.get(1).number);
                dataBinding.tvSxsm3.setText(detailsBean.detail.get(2).zodiac);
                dataBinding.tvSxsm6.setText(detailsBean.detail.get(2).number);
                break;
            case Constant.TYPE_3:
                dataBinding.tvTjlx1.setText(detailsBean.detail.get(0).zodiac);
                dataBinding.tvTjlx2.setText(detailsBean.detail.get(1).zodiac);
                dataBinding.tvTjlx3.setText(detailsBean.detail.get(2).zodiac);
                dataBinding.tvTjlx4.setText(detailsBean.detail.get(3).zodiac);
                dataBinding.tvTjlx5.setText(detailsBean.detail.get(4).zodiac);
                dataBinding.tvTjlx6.setText(detailsBean.detail.get(5).zodiac);
                break;
            case Constant.TYPE_4:
                dataBinding.tvZds.setText(detailsBean.detail.get(0).zodiac);
                break;
            case Constant.TYPE_5:
                dataBinding.tvJzts1.setText(detailsBean.detail.get(0).zodiac);
                dataBinding.tvJzts2.setText(detailsBean.detail.get(1).zodiac);
                break;
            case Constant.TYPE_6:
                dataBinding.tvWzws1.setText(detailsBean.detail.get(0).zodiac);
                dataBinding.tvWzws2.setText(detailsBean.detail.get(1).zodiac);
                dataBinding.tvWzws3.setText(detailsBean.detail.get(2).zodiac);
                dataBinding.tvWzws4.setText(detailsBean.detail.get(3).zodiac);
                dataBinding.tvWzws5.setText(detailsBean.detail.get(4).zodiac);
                break;
            case Constant.TYPE_7:
                dataBinding.tvCsbs1.setText(detailsBean.detail.get(0).zodiac);
                dataBinding.tvCsbs2.setText(detailsBean.detail.get(1).zodiac);
                break;
            case Constant.TYPE_8:
                dataBinding.tvJjcp.setText(detailsBean.detail.get(0).zodiac);
                break;
            case Constant.TYPE_9:
                dataBinding.tvSzs1.setText(detailsBean.detail.get(0).zodiac);
                dataBinding.tvSzs2.setText(detailsBean.detail.get(1).zodiac);
                dataBinding.tvSzs3.setText(detailsBean.detail.get(2).zodiac);
                dataBinding.tvSzs4.setText(detailsBean.detail.get(3).zodiac);
                dataBinding.tvSzs5.setText(detailsBean.detail.get(4).zodiac);
                dataBinding.tvSzs6.setText(detailsBean.detail.get(5).zodiac);
                break;
            case Constant.TYPE_10:
                dataBinding.tvDdym.setText(detailsBean.detail.get(0).zodiac);
                break;
            default:
                break;
        }
    }


    @Override
    public void failed(String message) {
        if ("用户不存在，请重新登录".equals(message)) {
            showDialog(message, 1);
        } else if ("账户已冻结，无法访问".equals(message)) {
            showDialog(message, 2);
        } else {
            showMsg(message);
        }
    }

    private void showDialog(String message, int type) {
        new CustomDialogView(this).setTitle("温馨提示").setMessage(message).setSureText("确定").setCancelable(false).showOneButton(true).setSureOnClickListener(view -> {
            if (1 == type) {
                SpUtil.clear(this);
                startActivity(new Intent(this, LoginActivity.class));
                finish();
            } else {
                finish();
            }
        }).build().show();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        SpUtil.remove(this, Constant.SELECTED_POSITION);
    }
}
